<template>
  <el-dialog title="余额" :close-on-click-modal="false" :visible.sync="visible">
    <el-form :model="dataForm"  ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
      <el-table :data="dataList" row-key="Id" border style="width: 100%; ">
        <el-table-column prop="mobile" align="center" label="收入/支出">
          <template slot-scope="scope">
           <div v-if="scope.row.billType==0">支出</div>
           <div v-if="scope.row.billType==1">收入</div>
           </template>
        </el-table-column>
        <el-table-column prop="remark" align="center" label="变动类型">
          <!-- <template slot-scope="scope">
           <div v-if="scope.row.billType==0">{{scope.row.remark}}</div>
           <div v-if="scope.row.billType==1"> {{scope.row.remark}}</div>
           </template> -->
        </el-table-column>
        <el-table-column prop="entryValue" align="center" label="变化">
          <template slot-scope="scope">
           <div v-if="scope.row.billType==0">-{{scope.row.entryValue}}</div>
           <div v-if="scope.row.billType==1">+{{scope.row.entryValue}}</div>
           </template>
        </el-table-column>
        <el-table-column prop="entryAfterBalance" align="center" label="余额">
        </el-table-column>
        <el-table-column prop="formatCreateTimeMillis" align="center" label="时间">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pamars.page"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pamars.limit"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>

    </el-form>
  </el-dialog>
</template>

<script>
  import {treeDataTranslate} from '@/utils'
  import seviceApi from '@/api/serviceApi.js'
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          id: '0'
  
        },
        pamars: {
  page: 1, limit: 10
        },
        dataList: [],
        totalPage: 0
      }
    },

    methods: {
      init (id) {
        this.dataForm.id = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
        })
        this.getList()
        // 获取金额明细
      },
      getList () {
        seviceApi.getRefillCardInfo(
        this.dataForm.id,
         this.pamars.page,
        this.pamars.limit
       ).then(res => {
         if (res && res.data.code == 200) {
           this.dataList = res.data.page.list
           this.totalPage = res.data.page.totalCount
         }
       })
      },
      sizeChangeHandle (val) {
        this.pamars.limit = val
        this.getList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pamars.page = val
        this.getList()
      }
    }
  }
</script>

<style lang="scss">

</style>
